﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace DevWeb.Biztalk.DeploymentSettings.WebUI.Models
{
    public class IntegrationVersionViewModel:BaseViewModel
    {
        #region Primitive Properties

        [DisplayName("ProductUpgradeCode")]
        [Required(ErrorMessage = "ProductUpgradeCode is required")]
        public string ProductUpgradeCode { get; set; }

        [DisplayName("IntegrationId")]
        [Required(ErrorMessage = "IntegrationId is required")]
        public int IntegrationId { get; set; }

        [DisplayName("IntegrationName")]
        [Required(ErrorMessage = "IntegrationName is required")]
        public string IntegrationName { get; set; }

        [DisplayName("ProductId")]
        [Required(ErrorMessage = "ProductId is required")]
        public Guid ProductId { get; set; }

        [DisplayName("Version")]
        [Required(ErrorMessage = "Version is required")]
        public string Version { get; set; }

        [DisplayName("Decription")]
        [StringLength(500, ErrorMessage = "Between 0 and 500 Chars is allowed", ErrorMessageResourceName = null,
            ErrorMessageResourceType = null, MinimumLength = 0)]
        public string Description { get; set; }


        [DisplayName("PreviousIntergrationVersionId")]
        [Required(ErrorMessage = "ProductUpgradeCode is required")]
        public int PreviousIntergrationVersionId { get; set; }

        //[DisplayName("Settings Counter")]
        //public int SettingCount
        //{
        //    get
        //    {


        //        return (IntegrationVersionSettings == null) ? 0 : DeploymentLogs.Count;

        //    }
        //}

        //[DisplayName("Deployment Counter")]
        //public int DeploymentCount {
        //    get
        //    {


        //        return (DeploymentLogs == null) ? 0 : DeploymentLogs.Count;

        //    }
        //}

        [DisplayName("Datum Creation")]
        public DateTime CreateDateTime { get; set; }

        #endregion

        public List<DeploymentLogViewModel> DeploymentLogs { get; set; }

        public List<IntegrationVersionSettingsViewModel> IntegrationVersionSettings { get; set; }

       
    }
}